from rest_framework.response import Response


# 装饰器，检测用户是否登录
def IsLoginDeco(func):
    def wrapper(obj, request, *args, **kwargs):
        if not request.is_login:
            return Response({'message': '用户未登录', 'code': '10001'})
        return func(obj, request, *args, **kwargs)

    return wrapper